package com.dl.study.module.base.roleinfo.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.dl.study.module.base.roleinfo.domain.dto.RoleInfoListQueryDTO;
import com.dl.study.module.base.roleinfo.domain.dto.RoleInfoDTO;
import com.dl.study.module.base.roleinfo.domain.entity.RoleInfoEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * [ 角色信息表 ]
 *
 * @author dl
 * @version 1.0
 * @company xxxx
 * @copyright (c) 2018 xxxxInc. All rights reserved.
 * @date 2021-10-28 15:47:25
 * @since JDK1.8
 */
@Mapper
@Component
public interface RoleInfoDao extends BaseMapper<RoleInfoEntity> {

    /**
     * 分页查询
     *
     * @param queryDTO
     * @return RoleInfoDTO
     */
    List<RoleInfoDTO> queryListByCondition(IPage page, @Param("queryDTO") RoleInfoListQueryDTO queryDTO);

    /**
     * 根据条件查询列表
     *
     * @param queryDTO
     * @return RoleInfoDTO
     */
    List<RoleInfoDTO> queryListByCondition(@Param("queryDTO") RoleInfoListQueryDTO queryDTO);

    /**
     * 批量删除
     *
     * @param idList
     * @return
     */
    void deleteByIds(@Param("idList") List<Long> idList);

    /**
     * 批量新增
     *
     * @param entityList
     * @return
     */
    void insertBatch(@Param("entityList") List<RoleInfoEntity> entityList);

    List<String> selectRoleByLoginName(String account);

    /**
     * 通过用户id获取用户角色
     * @param userId
     * @return
     */

    List<String> getRolesByUserId(String userId);
}
